1. Field of the Invention
The present invention relates to a motion vector detection apparatus and method of the same and to an image processing apparatus.
2. Description of the Related Art
For example, the apparatus shown in FIG. 12 has been known as an image processing apparatus performing image compression and coding.
A pre-processing circuit 102 in an image processing apparatus 101 performs processing for conversion of the image format of image data S100 and outputs image data S102a obtained by the conversion processing to an image memory 103 and a motion detection circuit 104.
The motion detection circuit 104, as shown in FIG. 13, performs motion detection between a prior frame 150 input from the image memory 103 and a present frame 151 input from the pre-processing circuit 102 in units of macroblocks MB of 16xc3x9716 pixels within a search area 152 indicated by a search area designation signal S108a input from a control circuit 108 to produce a motion vector 153.
The reason for performing the motion detection on a search area defined in part of an effective screen is that if the motion detection is performed over all of the effective screen, the amount of calculation becomes enormous, the apparatus becomes large in scale, and the processing time becomes long.
The produced motion vector or a residual vector produced using the motion vector is subjected to DCT processing in a DCT/quantization circuit 105 to produce a DCT coefficient. The DCT/quantization circuit 105 quantizes the DCT coefficient using a quantization step indicated by a Q-scale signal S108b input from the control circuit 108, then outputs it to a variable length coding circuit 106.
The quantized DCT coefficient is coded by variable length in the variable length coding circuit 106, then is output through a buffer memory 107 to a recording system or a transmission system.
A method of determining the search area of motion detection by the motion detection circuit 104 by a conventional control circuit 108 will be explained below.
For example in a Moving Picture Experts Group (MPEG) and other moving picture compression systems, in order to compress a series of frames constituting a moving picture using bidirectional prediction, coding is performed by three types of pictures, that is, an intra-coded (I) picture, a predictive-coded (P) picture, and a bidirectional (B) picture. An I-picture is a frame which is obtained by coding an input frame as it is without prediction, a P-picture is a frame using one-directional motion compensation prediction, and a B-picture is a frame using bidirectional prediction.
Within image data S100, as shown in FIG. 14, pictures located in time in the order of B0, P1, B2, B3, and P4 pictures are encoded in the image processing apparatus 100 in the order of the B0, P1, P4, B2, and B3 pictures on the basis of the relationship of previous and following pictures.
Here, B and P indicate the B-picture and P-picture respectively. The numbers following them indicate the order of location in time in the image data.
Conventionally, when the B0 picture is encoded, a motion vector frmvBP from a B0 picture to P2 picture is found in units of macroblocks. Next, when the P4 picture is encoded, since the distance in time between the P1 picture and the P4 picture is three times as long as that between the B0 picture and the P1 picture, assuming that the same motion as the motion vector frmvBP continues, as shown in FIG. 15, a motion vector frmvPP from the P1 picture to the P4 picture is found by tripling the motion vector frmvBP.
In the conventional method described above, for example, as shown in FIG. 16A, when the motion vector frmvBP, the motion vector frmv between the P1 picture and the B2 picture, and the motion vector frmv3 between the B3 picture and the P4 picture are almost the same, that is, when almost the same motion continues, a suitable search area can be set.
Summarizing the problem to be solved by the invention, the method of the related art described above suffered from the problem that when there is a difference between the motion vector frmvBP, motion vector frmv1, motion vector frmv2, and motion vector frmv3, that is, when the motion of the image is severe (rapid), the motion vector frmvPP found by tripling the motion vector frmvBP and the actual motion vector obtained by adding the motion vectors frmv1, frmv2, and frmv3 no longer match, a suitable search area can no longer be set.
An object of the present invention is to provide a motion vector detection apparatus and method of the same and an image processing apparatus able to determine a suitable search area when detecting a motion vector for a rapid motion image.
According to a first aspect of the present invention, there is provided a motion vector detection apparatus for detecting a motion vector of image data between a plurality of frames, comprising a motion detection circuit specifying image data of a first block matching or almost matching image data of a first block within a first frame in a search area designated within a second frame located before the first frame in time and detecting a motion vector from a positional relationship between the first block of the first frame and the specified first block in the search area of the second frame; a first control circuit specifying the search area by using motion vector of image data found in units of the first blocks between a plurality of frames located before the second frame in time; a simplified motion vector detection circuit detecting a simplified motion vector indicating motion of an image in units of second blocks larger than the first block by using the first frame, the second frame, and a frame located between the first frame and the second frame; a second control circuit specifying the search area by using the simplified motion vector; and a third control circuit judging whether or not a change of motion between the first frame and the second frame is larger than a predetermined standard, designating a search area specified by the second control circuit in the motion detection circuit when the change of motion is larger than the predetermined standard, and designating a search area specified by the first control circuit in the motion detection circuit when the change of motion is not larger than the predetermined standard.
Preferably, the third control circuit finds a cumulative sum of differences which is defined as a cumulative sum of absolute values of differences between simplified motion vectors adjacently located in time within a predetermined section, judges whether or not the cumulative sum of differences is larger than a predetermined standard value, designates the search area specified by the second control circuit in the motion detection circuit when judging the cumulative sum of differences is larger than the standard value, and designates the search area specified by the first control circuit in the motion detection circuit when judging the cumulative sum of differences is not larger than the standard value.
Preferably, the standard value is a fixed multiple of an average value of magnitude of the simplified motion vector detected within the predetermined section.
Alternatively, preferably, the third control circuit finds the cumulative sum of differences by removing from the detected simplified motion vectors in a predetermined section a simplified motion vector having a difference more than a predetermined standard value between average values of two simplified motion vectors located before and after each other adjacent in time.
Preferably, the first control circuit finds a motion vector between the second frame and a third frame located immediately before in time from the second frame in units of the first blocks and specifies the search area by using the motion vector which is found by multiplying the found motion vector by a number defined by a distance of time between the first frame and the second frame.
According to a second aspect of the present invention, there is provided an image processing apparatus for detecting a motion vector of an image between a plurality of frames and compressing the image data by using the motion vector, comprising a motion detection circuit specifying image data of a first block matching or almost matching image data of a first block within a first frame in a search area designated within a second frame located before the first frame in time and detecting a motion vector from a positional relationship between the first block of the first frame and the specified first block in the search area of the second frame; a first control circuit specifying the search area by using motion vector of image data found in units of the first blocks between a plurality of frames located before the second frame in time; a simplified motion vector detection circuit detecting a simplified motion vector indicating motion of an image in units of second blocks larger than the first block by using the first frame, the second frame, and a frame located between the first frame and the second frame; a second control circuit specifying the search area by using the simplified motion vector; a third control circuit judging whether or not a change of motion between the first frame and the second frame is larger than a predetermined standard, designating a search area specified by the second control circuit in the motion detection circuit when the change of motion is larger than the predetermined standard, and designating a search area specified by the first control circuit in the motion detection circuit when the change of motion is not larger than the predetermined standard; and an orthogonal transformation circuit for performing orthogonal transformation on the image data by using the detected motion vector; and a quantization circuit for quantifying the orthogonally transformed image data.
According to a third aspect of the present invention, there is provided a method of motion vector detection for detecting a motion vector of an image between a plurality of frames, comprising the steps of specifying image data of a first block matching or almost matching with image data of the first block within a first frame from a search area designated in a second frame located before the first frame in time and detecting a motion vector from a positional relationship between the first block of the first frame and the specified first block in the search area of the second frame; finding a first search area by using a motion vector of image data found in units of the first blocks between a plurality of frames located before the second frame in time; detecting a simplified motion vector indicating motion of an image in units of second blocks larger than the first block by using the first frame, the second frame, and a frame located between the first frame and the second frame in time; finding a second search area by using the simplified motion vector; and judging whether or not a change of motion between the first frame and the second frame is larger than a predetermined standard based on the detected simplified motion vector, designating the second search area when the change of motion is judged larger than the predetermined standard, and designating a first search area when the change of motion is judged not larger than the predetermined standard.